//
//  PerspectiveViewController.m
//  PerspectiveDrawing
//
//  Created by cluy on 14-8-12.
//  Copyright (c) 2014年 yangdan. All rights reserved.
//

#import "PerspectiveViewController.h"

@interface PerspectiveViewController ()

@end

@implementation PerspectiveViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    //采取子视图
    self.MoveView.clipsToBounds = YES;
}

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    originalLocation = [[touches anyObject] locationInView:_MoveView];
    NSLog(@"self.view = %@",NSStringFromCGPoint(originalLocation));
}

-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{

    CGPoint currentLocation = [[touches anyObject] locationInView:_MoveView];
     NSLog(@"moveView = %@",NSStringFromCGPoint(currentLocation));
    CGRect frame = _MoveView.frame;
    frame.origin.y += currentLocation.y;
    _MoveView.frame = frame;
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
         self.CarImgView.frame= CGRectMake(self.CarImgView.frame.origin.x, -frame.origin.y, 568 , 320);
    }else
    {
        self.CarImgView.frame= CGRectMake(self.CarImgView.frame.origin.x, -frame.origin.y, 1024, 768);
    }
    
    NSLog(@"moveViewEnd = %@",NSStringFromCGRect(_MoveView.frame));
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
